<?
session_start();
include("config.php");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
		  <script type="text/javascript" src="tooltip.js"></script>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="stylesheet" media="screen" type="text/css" title="style" href="style.css" />
	    <!--<script type="text/javascript" 
		    src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
        <script type="text/javascript" 	src="jquery.hoverattribute-1.0.7.min.js"></script>-->

        <title>Life Stream</title>
    </head>

    <body>
        <header class=main>
            <section class=logo> <a href="index.php"><img src="logo.png" alt="Life Stream !" height="25" /></a> </section>
            <section class=searchzone> 
				<form method="post" action="index.php">
				<input type="text" placeholder="Search" name="search" />
				<input class=button type="submit" value="Valider" />
				</form> 
			</section>
            <nav class=headernav>  
                
				<?
				if(isset($_SESSION['pseudo']))
                	echo '<a href="index.php?profil=1">Profil</a>';
				?>
            </nav>
			<?
			if(!isset($_SESSION['pseudo']))
			{
				include("php/connexion.php");
			}
			else
			{
				include("php/disconnect.php");
			}
			?>
           <a href="index.php?help=1">Help</a> 
            </section>
        </header>

		<!-- Main -->
        <section class=main>

       			    <!-- Pannel de gauche -->
                <section class=news>
			    <?
                if(!isset($_POST['search']))
                {
				    if(isset($_SESSION['pseudo']))
				    {
					    if(isset($_GET['profil']))
					    {	
						    include('php/print_my_stream.php');						
					    }
					    else if(isset($_GET['user']))
					    {
						    include('php/print_member_stream.php');	
					    }
                        else if(isset($_GET['help']))
					    {
						    include('php/print_stream.php');	
					    }
					    else
					    {
						    include('php/print_friend_stream.php');
					    }

				    }
				    else
				    {
					    if(isset($_GET['user']))
					    {
						    include('php/print_member_stream.php');	
					    }
					    else
					    {
						    include('php/print_stream.php');
					    }
				    }
                }
                else
                {
                    include('php/news_search.php');	
                }
			    ?>
                </section>

			    <!-- Pannel de droite -->
			    <section class=panel>
			    <?
                if(!isset($_POST['search']))
                {
                    
                    if(isset($_GET['help']))
                    {
                            echo '<div class=help>';
                            include('help.html');
                            echo '</div>';
                    }
					else
					{
						if(isset($_SESSION['pseudo']))
						{
							echo 'Hello ' . $_SESSION['pseudo'] . '<br>';
							if(isset($_GET['profil']))
							{
								echo '<div class=borderBottom>';
		                        include('php/info_profil.php');
								echo '<br><br></div><br>';
								echo '<div class=borderBottom>Add a stream:<br>';
								include('php/add_stream.php');	
								echo '</div>';					
							}
							else if(isset($_GET['user']))
							{
								echo '<div class=borderBottom>';
								include('php/stream_subscription.php');
								echo '<br></div>';	
								echo '<div class=borderBottom><br>';
		                        include('php/info_member.php');
								echo '<br><br></div>';

							}
							else
							{
								echo '<div class=borderBottom>';
		                        include('php/info_profil.php');
								echo '<br><br></div><br>';
								echo '<div class=borderBottom>Add a stream:<br>';
								include('php/add_stream.php');
								echo '</div>';

							}
						}
						else
						{
							echo '<div class=borderBottom>';
							include('php/subscription.php');
							echo '<br></div><br>';
							echo '<div class=borderBottom>';
							include('php/infos_deco.php');
							echo '<br><br></div>';
						}
					}
                }
                else
                {
                    include('php/search.php');	
                }
			    ?>
               </section>
         

			<div id="tooltip">
    </div>

			<section class=flush>
			</section>

        </section>

        <footer class=main>
            © 2011 LifeStream Inc.
        </footer>
    </body>

</html>
<?

mysql_close($link);
?>
